package fr.utbm.gl52.smartgrid.model;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import fr.utbm.gl52.smartgrid.model.device.Device;
import fr.utbm.gl52.smartgrid.model.device.IDevice;
import fr.utbm.gl52.smartgrid.model.storage.Capacity;

public class BusDC {

	/* ===== STATIC ===== */
	private static BusDC instance = new BusDC();

	public static BusDC getInstance() {
		return instance;
	}

	private BusDC() {
	}

	/* ===== ATTRIBUTES ===== */
	private Map<UUID, IDevice> deviceList = new HashMap<UUID, IDevice>();
	private ElectricalNetwork network;

	private Capacity capacitor;
	private double Umin;
	private double Umax;

	/* ===== METHODS ===== */
	public boolean verifyObjective() {
		return true;
	}

	public double calcCurrent() {
		return 0;
	}

	public double calcVoltage() {
		return 0;
	}

	public double calcTotalConsumedHydrogen() {
		return 0;
	}

	/* ===== ACCESSORS ===== */

	public Capacity getCapacitor() {
		return this.capacitor;
	}

	public void setCapacitor(Capacity capacitor) {
		this.capacitor = capacitor;
	}

	public int getNbDevices() {
		return this.deviceList.size();
	}

	public double getUmin() {
		return this.Umin;
	}

	public void setUmin(double umin) {
		this.Umin = umin;
	}

	public double getUmax() {
		return this.Umax;
	}

	public void setUmax(double umax) {
		this.Umax = umax;
	}

	public IDevice getDevice(UUID uuid) {
		return this.deviceList.get(uuid);
	}

	public void addDevice(IDevice device) {
		this.deviceList.put(device.getID(), device);
	}

	public Map<UUID, IDevice> getDeviceList() {
		return this.deviceList;
	}

	public ElectricalNetwork getNetwork() {
		return this.network;
	}

	public void setNetwork(ElectricalNetwork network) {
		this.network = network;
	}

}
